package LeetCode.interview;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import LeetCode.interview._104_Maximum_Depth_of_Binary_Tree.TreeNode;

import sun.tools.jar.resources.jar;
import util.LogUtils;

/*
 * 
原题　
	 Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.
	
	For example:
	
	Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it.
	
	Follow up:
	Could you do it without any loop/recursion in O(1) runtime?
	
	Credits:
	Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases.
题目大意
	给定非负整数num，重复添加其所有数字，直到结果只有一位数字。
	
	例如：
	
	给定num = 38，过程如下：3 + 8 = 11，1 + 1 = 2。由于2只有一位，返回。
	
	跟进：
	你可以在O（1）运行时没有任何循环/递归吗？
解题思路
	
 * @Date 2017-09-14 23：43
 */
public class _258_Add_Digits {
    public int addDigits(int num) {
    	
        return 0;
    }
	public static void main(String[] args) {
		_258_Add_Digits obj = new _258_Add_Digits();
//		obj.twoSum(new int[]{1, 2, 3, 4, 5, 6, 7}, 7);
//		obj.twoSum2(new int[]{2, 7, 11, 15}, 9);
		obj.addDigits(6);
	}

}
